<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>INDEX</title>
    <meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1">

    <!-- Link Swiper's CSS -->
    <link rel="stylesheet" href="/swiper/swiper-4.2.2.min.css">
    <link rel="stylesheet"  href="/layui/css/layui.css">
    <script src="/layui/layui.all.js"></script>
    <script src="/jquery/jquery-3.3.1.min.js"></script>
    <script src="/myTool/template-web.js"></script>


    <!-- Swiper JS -->
    <script src="/swiper/swiper-4.2.2.min.js"></script>


</head>
<body>
<!-- Swiper -->
<div class="swiper-container">
    <div class="swiper-wrapper" id="tpl-photo">
    </div>
    <!-- Add Pagination -->
    <div class="swiper-pagination"></div>
    <!-- Add Arrows -->
    <div class="swiper-button-next"></div>
    <div class="swiper-button-prev"></div>
</div>
<div>
    <div style="width: 100%;text-align: center">
        <button class="layui-btn layui-btn-primary" onclick="doSome('sys/register')">注册</button>
        <button class="layui-btn" onclick="doSome('sys/login')">登录</button>
        <button class="layui-btn layui-btn-normal" onclick="doSome('test/photo')">图片上传</button>
        <button class="layui-btn layui-btn-warm" onclick="doSome('test/indexPhoto')">首页轮播修改</button>
        <button class="layui-btn layui-btn-danger" onclick="doSome('sys/userOption')">警告按钮</button>
        <button class="layui-btn layui-btn-disabled" onclick="doSome('sys/jobManager')">禁用按钮</button>
    </div>


</div>
<script id="temp-photo" type="text/html">
    {{each photos}}
    <div class="swiper-slide"><img src="{{$value.url}}"></div>

    {{/each}}
</script>

<script>

    $(function () {

        $.post("/photo/getPhotoList",{},function (data){
            var html = template('temp-photo', data);
            $("#tpl-photo").append(html);
            jiazai();
        },"json")
    });


    function doSome(temp) {
        window.location.href="/index?path="+temp;
    }
</script>



<!-- Initialize Swiper -->
<script>
    function jiazai() {
        var swiper = new Swiper('.swiper-container', {
            autoplay:true,//等同于以下设置
            autoplay: {
                delay: 3000,
                stopOnLastSlide: true,
                disableOnInteraction: false,
            },
            slidesPerView: 1,
            spaceBetween: 30,
            loop: true,
            pagination: {
                el: '.swiper-pagination',
                clickable: true,
            },
            navigation: {
                nextEl: '.swiper-button-next',
                prevEl: '.swiper-button-prev',
            },
        });
    }

</script>
</body>
</html>
<!-- Demo styles -->
<style>
    html, body {
        position: relative;
        height: 100%;
    }
    body {
        background: #eee;
        font-family: Helvetica Neue, Helvetica, Arial, sans-serif;
        font-size: 14px;
        color:#000;
        margin: 0;
        padding: 0;
    }
    .swiper-container {
        width: 100%;
        height: 500px;
        margin-left: auto;
        margin-right: auto;
    }
    .swiper-slide {
        text-align: center;
        font-size: 18px;
        background: #fff;

        /* Center slide text vertically */
        display: -webkit-box;
        display: -ms-flexbox;
        display: -webkit-flex;
        display: flex;
        -webkit-box-pack: center;
        -ms-flex-pack: center;
        -webkit-justify-content: center;
        justify-content: center;
        -webkit-box-align: center;
        -ms-flex-align: center;
        -webkit-align-items: center;
        align-items: center;
    }
</style>
